//
//  Emoticon.swift
//  01-表情键盘 Emotion
//
//  Created by wulei on 15/12/15.
//  Copyright © 2015年 wulei. All rights reserved.
//

import UIKit

class Emoticon: NSObject {
    // 发送给服务器的表情字符串
    var chs: String?
    // 在本地显示的图片名称
    var png: String?
    // emoji 字符串编码
    var code: String?{
        didSet{
            emoji = code?.emoji
        }
    }
    /// emoji 的字符串
    var emoji: String?
    // 拼接完整的路径
    var imagePath: String {
        
        if png == nil {
            return ""
        }
        
        return NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + png!
        
        
    }
    
    // 是否删除按钮标记
    var isRemoved = false
    // MARK: - 构造函数Removed
    init(isRemoved: Bool) {
        self.isRemoved = isRemoved
    }
    
    // 是否空白按钮标记
    var isEmpty = false
    
    // MARK: - 构造函数Empty
    init(isEmpty: Bool) {
        self.isEmpty = isEmpty
    }
    
    init(dict:[String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    override var description: String {
        let key = ["chs","png","code","isRemoved"]
        return dictionaryWithValuesForKeys(key).description
    }
    
}
